﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace GUI.UserControls
{
    public partial class MenuOnglet : UserControl
    {
        private Menu _menu;

        public MenuOnglet()
        {
            InitializeComponent();
        }

        public void Init(Menu papa)
        {
            _menu = papa;
        }

        public void charger(String[] lesBoutons)
        {
            traiterUnBouton(lesBoutons[0], btn1);
            traiterUnBouton(lesBoutons[1], btn2);
            traiterUnBouton(lesBoutons[2], btn3);
            traiterUnBouton(lesBoutons[3], btn4);
            traiterUnBouton(lesBoutons[4], btn5);
        }

        private void traiterUnBouton(String text, Control leBouton)
        {
            if (text != "")
            {
                leBouton.Visible = true;
                leBouton.Text = text;
            }
            else
                leBouton.Visible = false;
        }

        private void btn_Click(object sender, EventArgs e)
        {
            _menu.recevoirClickSurMenuOnglet(((Control)sender).Text);
        }

    }
}
